<template>
  <Table :columns="columns" :data="forms"></Table>
  <!-- <List border>
    <ListItem v-for="item in forms" :key="item.id">
      <ListItemMeta :title="item.name" />
      <template slot="action">
        <RPButton text="选择" optType="create" type="info" @click="onClick(item)" />
      </template>
    </ListItem>
  </List> -->
</template>

<script>
export default {
  name: 'selectForm',
  props: {
    forms: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      columns: [
        {
          title: '表单名称',
          key: 'name'
        },
        {
          title: '类型',
          key: 'subType'
        },
        {
          title: '当前填报周期',
          key: 'period'
        },
        {
          title: '操作',
          render: (h, params) => {
            return h('RowTools', {
              props: {
                data: [
                  {
                    type: 'text',
                    text: '选择',
                    handle: () => {
                      this.onClick(params.row)
                    }
                  }
                ]
              }
            })
          }
        }
      ]
    }
  },
  mounted() {
    this.$emit('SetTitle', '新建表单')
    this.$emit('SetPageWidth', 800)
    this.$emit('SetPageMinHeight', 200)
  },
  methods: {
    onClick(item) {
      this.$emit('Close', item)
    }
  }
}
</script>
